/*
 * @Descripttion: 
 * @Author: voanit
 * @Date: 2022-06-01 12:05:10
 * @LastEditors: voanit
 * @LastEditTime: 2022-06-08 12:27:25
 */
import { ProfileAction } from '@/types/store'
import { User, UserProfile } from '@/types/data'
// import { getToken } from '@/utils/storage'

type ProfileState = {
  user: User,
  userProfile: UserProfile
}
const initialState = {
  user: {},
  userProfile: {}
} as ProfileState
const profile = (state = initialState, action: ProfileAction): ProfileState => {
  // console.log(action, 111);

  switch (action.type) {
    case 'profile/getUser':
      return {
        ...state,
        user: action.payload
      }
    case 'profile/getUserProfile':
      return {
        ...state,
        userProfile: action.payload
      }
    default:
      return state
  }
}

export default profile